
echo "make system"

dmsetup remove_all



echo "============ Format sda3 ==============="
mkfs.xfs -f /dev/sda3



#vg name 
vg_name=VG`date +%s`
echo "============= create lvm ================"
echo y|pvcreate /dev/sda3
vgcreate $vg_name /dev/sda3

echo y|lvcreate -L 30G -n var $vg_name
echo y|lvcreate -l 100%FREE -n home $vg_name



echo "============ Format lvm ==============="
mkfs.xfs -f  /dev/mapper/$vg_name-var
mkfs.xfs -f  /dev/mapper/$vg_name-home



echo "============ mount / ==============="
mount /dev/mapper/$vg_name-home /home

echo "/dev/mapper/$vg_name-home /home                       xfs     defaults        1 2" >> /etc/fstab
echo "mount 成功"
